import threading
import time

class PrintThread(threading.Thread):
    def __init__(self, name, delay):
        super().__init__()
        self.name = name
        self.delay = delay

    # 线程执行函数
    def run(self):
        for i in range(5):
            print(f"{self.name}: {i}")
            time.sleep(self.delay)

# 创建两个线程
thread1 = PrintThread("线程1", 0.6)
thread2 = PrintThread("线程2", 0.4)

# 启动两个线程
thread1.start()
thread2.start()

# 等待两个线程执行完毕
thread1.join()
thread2.join()

print("主线程执行完毕")